package com.zetyun.tiger.connectors.http.async;

import cn.hutool.http.Method;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.zetyun.rt.meta.jsonschema.annotation.JsonSchemaFormat;
import com.zetyun.rt.meta.jsonschema.annotation.JsonSchemaTitle;
import com.zetyun.rt.models.protocol.aysnc.AsyncParameters;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonClassDescription;

import java.util.List;
import java.util.Map;

@Getter
@Setter
@ToString
@JsonClassDescription("http异步请求参数类")
public class HttpCallerParam extends AsyncParameters {


    @JsonSchemaTitle("请求路径")
    @JsonProperty(required = true,defaultValue = "http://36.32.166.247:9101/dataapi-core/apicommon/apiCallByWorkFlow")
    private String requestUrl;

    @JsonSchemaTitle("请求方法(POST)")
    @JsonProperty(defaultValue = "POST")
    private Method requestMethod;

    @JsonSchemaTitle("请求超时时间")
    @JsonProperty(defaultValue = "2000")
    private Integer timeoutMill;


    @JsonSchemaTitle("参数体所在jsonPath表达式")
    @JsonProperty(required = true, defaultValue = "HnaTransRequest.body.params")
    private String argsExpression;


    @JsonSchemaTitle("返回成功bool标志所在jsonPath表达式")
    @JsonProperty(required = true, defaultValue = "HnaTransResponse.success")
    private String resFlagExpression;


    @JsonSchemaTitle("返回所需数据所在jsonPath表达式")
    @JsonProperty(required = true, defaultValue = "HnaTransResponse.body.rows[0]")
    private String resDataExpression;

    @JsonSchemaTitle("返回字段名称")
    @JsonProperty(defaultValue = "RT_HTTP_RES")
    private String rtHttpResField;

    @JsonSchemaTitle("参数配置")
    private List<HttpParamPair> paramPairs;


    @JsonProperty(required = true)
    @JsonSchemaFormat(JsonSchemaFormat.SQL)
    @JsonSchemaTitle("请求参数模板")
    private Map<String, Object> params;
}
